Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Interpolation function of the ML sumcheck verifier corrected #75

Merged
merged 5 commits into from
Jun 29, 2023

Conversation

Antonio95
Copy link
Contributor

@Antonio95 Antonio95 commented Jun 23, 2023

Description

The verifier (file: src/ml_sumcheck/protocol/verifier.rs) contains a function (interpolate_uni_poly) which interpolates the unique polynomial of degree at most d passing through the points (0, y_0), (1, y_2), ..., (d, y_d); and returns the value of the interpolated polynomial at x = eval_at given as an argument.

In the pre-existing implementation, this function would crash if 0 <= eval_at <= d. In practice, eval_at is a challenge point generated pseudo-randomly by the verifier and so the problematic case could indeed be triggered.

The modified code now includes the check 0 <= eval_at <= d, returning y_eval_at if that is the case. The new checks come at essentially no performance cost (verified with a large example). A case has been added at the end of the unit test in the verifier.rs file which failed to pass with the previous code and passes with the modified one.

Furthermore, a slight inaccuracy has been corrected in the former description of the function: the returned polynomial does not necessarily have degree d, but at most d (and is unique with this property).


Before we can merge this PR, please make sure that all the following items have been
checked off. If any of the checklist items are not applicable, please leave them but
write a little note why.

  • Targeted PR against correct branch (master)
  • Linked to Github issue with discussion and accepted design OR have an explanation in the PR that describes this work.
  • Wrote unit tests
  • Updated relevant documentation in the code
  • Added a relevant changelog entry to the Pending section in CHANGELOG.md
  • Re-reviewed Files changed in the Github PR explorer

@Antonio95 Antonio95 marked this pull request as ready for review June 23, 2023 19:49
Comment on lines +136 to +138
/// p_i.len()-1 passing through the y-values in p_i at x = 0,..., p_i.len()-1
/// and evaluate this polynomial at `eval_at`. In other words, efficiently compute
/// \sum_{i=0}^{len p_i - 1} p_i[i] * (\prod_{j!=i} (eval_at - j)/(i-j))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
/// p_i.len()-1 passing through the y-values in p_i at x = 0,..., p_i.len()-1
/// and evaluate this polynomial at `eval_at`. In other words, efficiently compute
/// \sum_{i=0}^{len p_i - 1} p_i[i] * (\prod_{j!=i} (eval_at - j)/(i-j))
/// `p_i.len()-1` passing through the y-values in p_i at x = `0`, ..., `p_i.len()-1`
/// and evaluate this polynomial at `eval_at`. In other words, efficiently compute
/// \sum_{i=0}^{len p_i - 1} p_i[i] * (\prod_{j!=i} (eval_at - j)/(i-j))

@Pratyush Pratyush merged commit d8cb255 into arkworks-rs:master Jun 29, 2023
@Antonio95 Antonio95 deleted the interpolation_corrected branch June 29, 2023 13:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants